<template>
    <div class="home-wrapper">
        <project-menu :detail="projectDetail" :pid="projectId"></project-menu>
        <div class="filters-wrapper">
            <div class="title total_title">
                <span>{{title}}<font class="total_title_back" @click="$router.go(-1)">/ 返回上一级</font></span>
            </div>
            <el-row :gutter="30" type="flex" justify="start">
                <div class="sc_jump button-glow">
                    <router-link :to="{path: '/title/' + type + '/' + projectId}">标题</router-link>
                </div>
                <div class="sc_jump button-glow">
                    <router-link :to="{path: '/library/'+ type + '/' + projectId}">素材</router-link>
                </div>
                <div class="sc_jump button-glow">
                    <router-link :to="{path: '/label/'+ type + '/' + projectId}">标签</router-link>
                </div>
            </el-row>
        </div>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                title: '',
                type: '',
                projectId: 0,
                projectDetail: {},
                creativedata: []
            }
        },
        created() {
            this.projectId = this.$router.currentRoute.params.id
            this.type = this.$router.currentRoute.params.type
            if (this.type == 'project') {
                this.title = '项目素材库'
            } else {
                this.title = '个人素材库'
            }
        },
        mounted() {
            this.loadData()
        },
        methods: {
            loadData() {
                this.$axios.get('/project/detail', {projectid: this.projectId})
                .then(e => {
                    // console.log('项目详情', e.data)
                    this.projectDetail = e.data
                })
                // this.$axios.get('/creative/list')
                //     .then(e => {
                //         this.creativedata = e.data.items
                //         console.log('======', e.data)
                //     })
                //     .catch(err => {
                //         console.log('======', err)
                //     })
            },
            toggleSelection(rows) {
                if (rows) {
                    rows.forEach(row => {
                        this.$refs.multipleTable.toggleRowSelection(row);
                    });
                } else {
                    this.$refs.multipleTable.clearSelection();
                }
            },
            handsc() {
                this.$confirm('此操作将删除该项, 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    this.$message({
                        type: 'success',
                        message: '删除成功!'
                    });
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            }
        }
    }
</script>